import uvicorn

from app.core.config import settings
from app.core.server import create_app

app = create_app()

if __name__ == '__main__':
    from pathlib import Path

    app = Path(__file__).stem + ":app"
    uvicorn.run(
        settings.SERVER_APP if settings.SERVER_APP else app,
        host=settings.SERVER_HOST,
        port=settings.SERVER_PORT,
        log_config=settings.SERVER_LOG_CONFIG,
        reload=settings.SERVER_RELOAD,
        workers=settings.SERVER_WORKERS,
        timeout_keep_alive=settings.SERVER_TIMEOUT_KEEP_ALIVE,
    )
